<?
require './include/global.php';
require_once 'include/train_db.php';
$smarty->compile_check = true;


//$email = "terry.xh@gmail.com";
//$safeEmail= authcode ( $email, 'ENCODE', 'safeEmail', 3600 );  
//$urlEnSafeEmail = urlencode ( $safeEmail );  
  
/*链接 */  
//$link = "<a href = 'http://www.XXX.com/activation?code=$urlEnSafeEmail'>http://www.XXX.com/activation.html?code=$urlEnSafeEmail</a>";  
//exit;

//在 activation.html 页面  
$code = $_GET ['code'];  
$account = $_GET['account'];
$email = authcode ( $code, 'DECODE', 'safeEmail' );  

if($_GET['type'] == 'rec'){
	$sql = "SELECT * FROM pa_recuiter WHERE rc_uname = '".$account."' AND rc_email= '".$email."'";
	$rs = $DB->fetch_one_array($sql);
	if(empty($rs)){
		$content = "Error! This account has already been verified. Please contact us if you have any questions.";
	}else{
		$DB->query("UPDATE pa_recuiter SET rc_verify = 1 WHERE rc_uname = '".$account."' AND rc_email= '".$email."' ");
		$content = "Awesome! Your email is verified and your account is now active!<br><br> Welcome to enetRecruiter where professionals come to achieve greater recruiting success!";
		$_SESSION[uname] = $rs['rc_uname'];
		if(!empty($rs)){$_SESSION[usertype] = "recruiter"; $_SESSION[regtime] = $rs[rc_regtime]; $_SESSION[perfix] = "rc_";$_SESSION[uid] = $rs[rc_id];$_SESSION[homeUrl] = "rec_home.php"; $_SESSION[deadline] = $rs[rc_deadline]; $_SESSION['status'] = $ALLSTATUS[$rs[rc_status]];
		
		$_SESSION[useremail] = $rs[rc_email];
		$_SESSION[phone] = $rs[rc_phone];
		$_SESSION[realname] = $rs[rc_fname] ." ".$rs[rc_lname];
		$_SESSION[rc_copname] = $rs[rc_copname];
		redirect2("rec_home.php");
		exit;
		}
	}
}

$smarty->assign("content",$content);
$smarty->display('header.tpl');
$smarty->display('left.tpl');
$smarty->display('verify.tpl');
$smarty->display('right.tpl');
$smarty->display('footer.tpl');
?>